<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>{$activityname}</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="format-detection" content="telephone=no" />
<link href="{$Think.config.RESOURCEURL}wx_assets/css/common.css{$Think.config.RESOURCE_VER}" rel="stylesheet" type="text/css">
<link href="{$Think.config.RESOURCEURL}wx_assets/vote/vote.css{$Think.config.RESOURCE_VER}" rel="stylesheet">
<script type="text/javascript" src="{$Think.config.RESOURCEURL}wx_assets/js/zepto.1.1.3.min.js{$Think.config.RESOURCE_VER}"></script>
<script type="text/javascript" src="{$Think.config.RESOURCEURL}wx_assets/js/zepto.alert.js{$Think.config.RESOURCE_VER}"></script>
<script src="{$Think.config.RESOURCEURL}wx_assets/js/util.js{$Think.config.RESOURCE_VER}" type="text/javascript"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script src="{$Think.config.RESOURCEURL}wx_assets/js/wx_share.js{$Think.config.RESOURCE_VER}" type="text/javascript"></script>
    <style>
        html,body{height:100%;}
    </style>
</head>
<body class="bg-common" style="background-image:url({$jsonstr.COMMON_BACKGROUND.src})">
<!--<div class="bg-common index-zhuti">-->
    <!--<img src="{$jsonstr.INDEX_ZHUTI.src}"/>-->
<!--</div>-->
<div class="index-button-list">
    <if condition="$actStatus eq '0'">
        <a class="bg-common canjia js-btn" data-href='{$Think.config.SERVER_HOST}call.html?customerId={$customerId}&module=vote&method=reg&params=%7B%22actId%22%3A%22{$actId}%22%7D'  data-normal="{$jsonstr.INDEX_BUTTON_CANJIA_NORMAL.src}"  data-click="{$jsonstr.INDEX_BUTTON_CANJIA_CLICK.src}" style="background-image:url({$jsonstr.INDEX_BUTTON_CANJIA_NORMAL.src})">&nbsp;</a>
    <else/>
        <a class="bg-common canjia js-btn" data-event="_end" id="btnCanjia" data-normal="{$jsonstr.INDEX_BUTTON_CANJIA_NORMAL.src}"  data-click="{$jsonstr.INDEX_BUTTON_CANJIA_CLICK.src}" style="background-image:url({$jsonstr.INDEX_BUTTON_CANJIA_NORMAL.src})">&nbsp;</a>
    </if>
    <a class="bg-common paihangbang js-btn"data-href='{$Think.config.SERVER_HOST}call.html?customerId={$customerId}&module=vote&method=list&params=%7B%22actId%22%3A%22{$actId}%22%7D' data-normal="{$jsonstr.INDEX_BUTTON_PAIHANGBANG_NORMAL.src}" data-click="{$jsonstr.INDEX_BUTTON_PAIHANGBANG_CLICK.src}" style="background-image:url({$jsonstr.INDEX_BUTTON_PAIHANGBANG_NORMAL.src})">&nbsp;</a>
    <a class="bg-common js-btn" data-href='{$Think.config.SERVER_HOST}call.html?customerId={$customerId}&module=vote&method=rule&params=%7B%22actId%22%3A%22{$actId}%22%7D' data-normal="{$jsonstr.INDEX_BUTTON_HUODONG_NORMAL.src}" data-click="{$jsonstr.INDEX_BUTTON_HUODONG_CLICK.src}" style="background-image:url({$jsonstr.INDEX_BUTTON_HUODONG_NORMAL.src})">&nbsp;</a>
    <a class="bg-common js-btn" data-href='{$Think.config.SERVER_HOST}call.html?customerId={$customerId}&module=vote&method=prize&params=%7B%22actId%22%3A%22{$actId}%22%7D' data-normal="{$jsonstr.INDEX_BUTTON_PRIZE_NORMAL.src}" data-click="{$jsonstr.INDEX_BUTTON_PRIZE_CLICK.src}" style="background-image:url({$jsonstr.INDEX_BUTTON_PRIZE_NORMAL.src})">&nbsp;</a>
    <img id="INDEX_BUTTON_CANJIA" src="{$jsonstr.INDEX_BUTTON_CANJIA_CLICK.src}" style="display:none">
    <img id="INDEX_BUTTON_PAIHANGBANG" src="{$jsonstr.INDEX_BUTTON_PAIHANGBANG_CLICK.src}" style="display:none">
    <img id="INDEX_BUTTON_HUODONG" src="{$jsonstr.INDEX_BUTTON_HUODONG_CLICK.src}" style="display:none">
    <img id="INDEX_BUTTON_PRIZE" src="{$jsonstr.INDEX_BUTTON_PRIZE_CLICK.src}" style="display:none">
</div>
<script>
var baseUrl = '{$Think.config.SERVER_HOST}';
var shareUrl="";
var page={
    init:function(){
        this.initButtonState();
    },
    _end:function(){
        var state="{$actStatus}";
        if(state==1){
          $.util.alert("投票未开始!");  
        }
        if(state==2){
          $.util.alert("投票已截止!");  
        }
    },
    initButtonState:function(){
        var that=this;
        $(".js-btn").tap(function(){
            var me=this;
            var clickUrl=$(this).data("click");
            var normalUrl=$(this).data("normal");
            var href=$(this).data("href");
            var eventName=$(this).data("event");
            $(this).css("background-image","url("+clickUrl+")");
            setTimeout(function(){
                $(me).css("background-image","url("+normalUrl+")");
                if(href) {
                    location.href=href; 
                } else {
                    if(eventName){
                        that[eventName] && that[eventName]();
                    }
                }
               
            },100);
        });
    },
    getShareUrl:function(){
        var p=$.util.getParamAsObject();
        var shareUrl="";
        var params={
            "actId":"{$actId}",
            "qId":p.qId,
            "fromUId":"{$fromUId}"
        };
        params=encodeURIComponent(JSON.stringify(params));
        shareUrl=baseUrl+'call.html?customerId={$customerId}&module=vote&scope=1&method=index&params='+params;
        return shareUrl;
    }
}
page.init();
shareUrl=page.getShareUrl();
wx_share.init({
    "title":"{$title}",
    "desc":'{$description}',
    "link":shareUrl,
    "imgUrl":"{$picurl}",
    "pkg":{
        "appId": '{$pkg.appId}',
        "timestamp": {$pkg.timestamp},
        "nonceStr": '{$pkg.nonceStr}',
        "signature": '{$pkg.signature}'
    },
    success:function(config,shareType){
        var p=$.util.getParamAsObject();
        $.req.get("call.json?customerId={$customerId}&module=quan&method=saveShare",{
            params:{
                "qId":p.qId,
                "sId":"{$sId}",
                "guid":"{$guid}",
                "fromGuid":p.fromGuid,
                "miUId":"{$fromUId}",
                "shareType":shareType,
                "fromPage":"toupiao_index"
            }
        },function(data){
            if(data && !data.code){

            }
        });
    }
 });
</script>
</body>
</html>